package com.loongtech.bi.manager.ios;

import com.loongtech.bi.entity.ios.EntityDayProductManager;
import com.loongtech.core.jpa.manager.ManagerQueryCacheBase;
import com.loongtech.core.util.Time;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class DayProductManager extends ManagerQueryCacheBase<EntityDayProductManager> {

    private static final long serialVersionUID = 2L;

    private static List<String[]> MarkList; // 所有标示名称

    public Map<String, String> getProductMap() {
        Map<String, String> productItmes = new HashMap<String, String>();
        MarkList = findByQuery("select distinct productid, name  from EntityProductManager");
        productItmes = new HashMap<String, String>();
        for (Object[] s : MarkList) {
            productItmes.put((String) s[0] + "-" + (String) s[1], (String) s[0]);
        }
        return productItmes;
    }

    public Map<String, String> getProjectMap() {
        Map<String, String> projectItmes = new HashMap<String, String>();
        // markMap = Utils.getProjectids(PROJECT_URL);
        projectItmes = new HashMap<String, String>();
        projectItmes.put("权力与荣耀国内", "1");
        return projectItmes;
    }

    public List<EntityDayProductManager> getDayProducts(Date dateStart, Date dateEnd) {
        return findByQuery("from EntityDayProductManager where lookDate>=:dayStart and lookDate<=:dateEnd order by lookDate ", "dayStart", Time.getDateStr(dateStart), "dateEnd", Time.getDateStr(dateEnd));
    }
}